from concurrent.futures import ThreadPoolExecutor
import requests
import uuid
import json
import sys
import os

sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from model.car_number import CarNumber

from common.logger import logger
from account.epark_account_service import EParkAccountService
from spider.epark_park import EParkParkSpider
import spider_config

from proxy.tunnel_proxy_service_qg import TunnelProxyService_QG
proxy = TunnelProxyService_QG().take(spider_config.jie_park_id).build()

def test():
    service = EParkAccountService()
    service.active()
    while True:
        try:
            spider = EParkParkSpider()
            spider.setAccount(service.take())
            spider.setProxy(proxy)
            logger.success(spider.query(CarNumber("川LD1H38")))
        except Exception as e:
            logger.exception(e)


if __name__ == "__main__":
    test()
